<div class="button-item">
    <button pButton type="text" class="ui-button-success" icon="fa fa-download" (click)="download()"
        label="下载"></button>
</div>
<div class="ui-g-12" style="padding: 0px;">
    <p-treeTable [style]="{'margin-left': '-1px', 'margin-top': '-1px', 'width':'75vw'}" [value]="records"
        [resizableColumns]="true" [scrollable]="true" [scrollHeight]="'calc(100vh - 200px)'"
        [loading]="loading" [columns]="scrollableCols" [frozenColumns]="frozenCols" frozenWidth="200px">
        <ng-template pTemplate="colgroup" let-columns>
            <colgroup>
                <col *ngFor="let col of columns" [ngStyle]="{width: col.width + 'px'}">
            </colgroup>
        </ng-template>
        <ng-template pTemplate="header">
            <tr *ngFor="let header of headers">
                <th *ngFor="let col of header" [attr.rowspan]="col.rowspan" [attr.colspan]="col.colspan"
                    [ngStyle]="{'white-space':'nowrap', 'text-align':'center'}">
                    {{col.name}}
                </th>
            </tr>
        </ng-template>
        <ng-template pTemplate="body" let-rowNode let-rowData="rowData" let-columns="columns">
            <tr [ttRow]="rowNode">
                <td *ngFor="let col of columns; let i = index" [ngStyle]="{'white-space':'nowrap', 'text-align': col.textAlign}">
                    <ng-container *ngIf="col['detailFlag'] == 1 && rowData[col.fieldName] > 0">
                        <a class="reort-query-detail" (click)="showDetail(rowData, col.fieldName)">{{rowData[col.fieldName]}}</a>
                    </ng-container>
                    <ng-container *ngIf="col['detailFlag'] == 0 || rowData[col.fieldName] == 0">{{rowData[col.fieldName]}}</ng-container>
                </td>
            </tr>
        </ng-template>
        <ng-template pTemplate="frozenheader">
        <tr [ngStyle]="{height: frozenHeader.rowspan * 36 + 'px'}">
                <th>
                    {{frozenHeader.name}}
                </th>
            </tr>
        </ng-template>
        <ng-template pTemplate="frozenbody" let-rowNode let-rowData="rowData">
            <tr>
                <td>
                    <p-treeTableToggler [rowNode]="rowNode"></p-treeTableToggler>
                    {{rowData['_groups_']}}
                </td>
            </tr>            
        </ng-template>
    </p-treeTable>
</div>